package com.jsonpfy.webservices;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.appengine.repackaged.org.json.JSONObject;
import com.jsonpfy.operations.GetData;

@SuppressWarnings("serial")
public class GetDataServlet extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws IOException {

		String kind = request.getParameter("kind");

		String keyName = request.getParameter("ID");

		JSONObject entity = GetData.getJson(kind, keyName);

		String answer = Utilities.getCallback(request.getParameter("callback"),
				entity.toString());

		response.getWriter().println(answer);
	}
}
